< previous page page_146 next page >

Page 146
LISTING 6.2.CONTINUED
9f8044bafea36a1f728739c0bb58ef4c.gif
 4:     Set theForm = argForm
 5: End Sub
 6:
 7: Public Sub depositFunds(argAmount As Single, _
 8: argAccountNumber As String)
 9:     Dim returns, sAccountNumber As String
10:
11:     Set theDeposit = New Deposit
12:     sAccountNumber = argAccountNumber
13:
14:     theDeposit.Amount = argAmount
15:
16:     returns = theBasicPersonalCheckingAccount.adjustBalance( _
17:     theDeposit, sAccountNumber)
18:
19:     If returns Then
20:         theForm.lblAccountMaintForm(2).Caption = Complete
21:     End If
22:
23:     sAccountNumber =  
24:     Set theDeposit = Nothing
25: End Sub
26:
27: 'Include the following event handler:
28: Private Sub theBasicPersonalCheckingAccount_
     OnWrongAccountNumber(argMsg As String)
29:     theForm.lblAccountMaintForm(2).Caption = argMsg
30: End Sub

The command button cmdStore should have the following code in its Click event:
Private Sub cmdStore_Click()
    theFormController.setform Me
    theFormController.depositFunds _
        txtDepositAmount, txtAccountNumber
End Sub
The command button cmdDone should have the following code:
Private Sub cmdDone_Click()
    Set theFormController = Nothing
    Unload Me
End Sub
You are now ready to test drive your component. First, make sure the code for adjustBalance in the BasicPersonalChecking class resembles Listing 6.3.

 
< previous page page_146 next page >

If you like this book, buy it!